const http = require("http");
const url = require("url");
const qs = require("querystring");

const server = http.createServer((req, res) => {
  const { pathname, query } = url.parse(req.url);

  if (pathname === "/login") {
    const { name, password } = qs.parse(query);
    console.log(name, password);
    res.end("欢迎回来");
  }
});

server.listen(8000, "0.0.0.0", () => {
  console.log("服务器启动成功");
});
